package com.yuwei.parkinglot.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.parkinglot.R

class AddParkingStatusAdapter: BaseQuickAdapter<String, BaseViewHolder>(R.layout.parking_status_item) {
    private var position : Int = -1
    fun setPosition(position: Int) {
        this.position = position
    }
    fun getPosition(): Int {
        return position
    }
    override fun convert(holder: BaseViewHolder, item: String) {
        if(position == holder.position){
            holder.setBackgroundResource(R.id.parking_status_text,R.drawable.parking_status_item_selected_bg)
        }else{
            holder.setBackgroundResource(R.id.parking_status_text,R.drawable.parking_status_item_bg)
        }
        holder.setText(R.id.parking_status_text,item)
    }
}